<?php
!defined('LZ_MODULE') && die('Access Denied');
$m = $_GET['m'];

if ($m == 'login')
{
	$data = filter_array($_POST,'username!,password!');
	if ($data)
	{
		if ($data['username'] == 'longbill' && $data['password'] == 'wojiuswo')
		{
			$_SESSION['user'] = array(
					'username'=>'longbill'
				);
			lz_exit('yes!','index.php',0);
		}
		if (!$err_msg)
		{
			$err_msg = ACCOUNT_OR_PASSWORD_ERROR;
		}
	}
}
else if ($m == 'logout')
{
	$account->update( $_SESSION['login_account']['account_id'],array('login_ip' => ''));
	$_SESSION['login_account'] = null;
	$_SESSION['login_user'] = null;
	$_SESSION['login_ip'] = null;
	if ($back_url == 'index.php')
	{
		echo "<script>window.close();</script>";
		die;
	}
	lz_exit(LOGOUT_SUCCESS,$back_url,1);
}	


$_temp = template('login.html');
$_temp->assign('err_msg',$err_msg);
$_temp->assign('module',$module);
$view_html = $_temp->result();


?>
